package com.gdwstudy.array_;

import java.lang.reflect.Array;
import java.util.Arrays;

/**
 * @author 关道伟
 * @version 1.0
 */
public class ArrayMethod02 {
    public static void main(String[] args) {

        Integer[] arr = {1,2,3,4,6,8,12,45};
        int index = Arrays.binarySearch(arr,6);
        System.out.println(Arrays.toString(arr));
        System.out.println("6的下标 index="+index);
        //如果数组不存在的话 返回的是应该存在的位置+1

        Integer newarr[] = Arrays.copyOf(arr,arr.length);
        System.out.println("拷贝后的数组");
        System.out.println(Arrays.toString(newarr));


        //fill数组填充
        Integer[] num = new Integer[]{2,3,9};
        Arrays.fill(num,999);
        System.out.println("====数组填充后====");
        System.out.println(Arrays.toString(num));
    }
}
